const apiUrl = "http://localhost:3000"

const http = (url, data, method = 'get') => {
    return new Promise((resolve, reject) => {
        wx.request({
          url: apiUrl + url,
          data,
          method,
          success: res => {
            resolve(res)
          },
          fail: err => {
            reject(err)
          }
        })
    })
}

export default http